package sort;

import java.util.Arrays;

public class SelectionSort {
    public static int[] Sort(int[] arr) {
        if (arr.length == 0) {
            return null;
        }
        int n = arr.length;
        for (int i = 0; i < n; i++) {
            int minIndex = i;
            for (int j = i; j < n; j++) {
                if (arr[minIndex] > arr[j]) {
                    minIndex = j;
                }
            }
            int temp = arr[i];
            arr[i] = arr[minIndex];
            arr[minIndex] = temp;
        }
        return arr;
    }
}
